package com.kiln.juxingqs.adapter

import android.content.Context
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import client.global.commlib.base.BaseAdapter
import client.global.commlib.base.BindingViewHoder
import com.kiln.juxingqs.R
import com.kiln.juxingqs.api.bean.GoodsDetail
import com.kiln.juxingqs.databinding.LayoutGuadItemBinding

class GysAdapter : BaseAdapter<GoodsDetail.GHangingOrder> {

    constructor(context: Context) : super(context) {
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {

        return BindingViewHoder(
            DataBindingUtil.inflate(
                layoutInflater,
                R.layout.layout_guad_item,
                parent,
                false
            )
        )
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val binding = (holder as BindingViewHoder<LayoutGuadItemBinding>).binding
        val item = getItem(position)

        binding.tvNo.apply {
            text = (position + 1).toString()
            setBackgroundResource(R.drawable.circle_green_bg_seq)
        }

        binding.tvNum.text = item.surplus_num

//        item.surplus_num

//        if(type==1){
//            binding.stateTv.setBackgroundResource(R.drawable.circle_red_bg_seq)
//        }else{
//            binding.stateTv.setBackgroundResource(R.drawable.circle_green_bg_seq)
//        }

//        binding.tv.text = item

    }

}